﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/SystemManagement/Views/Shared/LigerUI.Master"
    Inherits="System.Web.Mvc.ViewPage<Zhuang.Model.EF.Sys_Role>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        function onBegin() {
            if ($.trim($("#roleName").val()) == "") {
                $.ligerDialog.warn("角色名不能为空！");
                return false;
            } else {
                return true;
            }

        }
        function onSuccess(result) {
            
            if (result.get_data() == "0") {
                $.ligerDialog.success("角色名已经存在！");
            } else {
                parent.f_reload();
                parent.f_close();
            }
        }
        function onFailure(result) {
            $.ligerDialog.error('保存失败！');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        string roleNameAtr = "";
        if (Model.RoleId != -1)
        {
            roleNameAtr = "disabled='disabled'";
        }
        using (Ajax.BeginForm(new AjaxOptions() { Url = Url.Action("SaveRole", "Role", new { area = "SystemManagement" }), HttpMethod = "Post", OnFailure = "onFailure", OnSuccess = "onSuccess", OnBegin = "onBegin" }))
      {%>
    <div>
        <input id="roleId" name="roleId" type="hidden" value="<%=Model.RoleId %>" />
        <table cellpadding="10" cellspacing="10" align="center" style="border-collapse: separate;
            border-spacing: 10px;">
            <tr>
                <td>
                    角色名
                </td>
                <td>
                    <input type="text" id="roleName" name="roleName" <%=roleNameAtr%> value="<%=Model.RoleName%>" />
                </td>
            </tr>
            <tr>
                <td>
                    备注
                </td>
                <td>
                <textarea id="description" name="description" cols="20" rows="2"><%=Model.Description %></textarea>
                <%--<textarea id="description" cols="20"　name="description"  rows="2"><%=Model.Description %></textarea>--%>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value="提交" style="width: 40px;" />
                </td>
                <td>
                    <input type="button" value="取消" onclick="parent.w.close()" style="width: 40px;" />
                </td>
            </tr>
        </table>
    </div>
    <%} %>
</asp:Content>
